﻿@model ValueTuple<IEntity, DataField>
@using NewLife;
@using NewLife.Cube
@using XCode;
@using XCode.Configuration;
@{
    var entity = Model.Item1;
    var field = Model.Item2;
    var fn = field.Name.ToLower();
    var value = entity[field.Name] as String;
}

<input id="@fn" name="@fn" type="file" class="layui-upload-drag" autocomplete="off" placeholder="" value="@entity[field.Name]" />

    @switch (field.ItemType)
    {
        case "image":
            {
                @*<span class="input-group-text"><i class="bi bi-images"></i></span>*@
                if (!value.IsNullOrEmpty())
                {
                    <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                        预览图：
                        <div class="layui-upload-list">
                            <a href="/Cube/Image/@value" target="_blank">
                                <img src="/Cube/Image/@value" class="layui-upload-img" style="width: 92px;height: 92px;margin: 0 10px 10px 0;"/>
                            </a>
                        </div>
                    </blockquote>
                }
                break;
            }
        case "file":
            {
                <span class="input-group-text"><i class="bi bi-folder"></i></span>
                break;
            }
        default:
            <span class="input-group-text"><i class="fas fa-file-upload"></i></span>
            break;
    }
